<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>优惠券</title>
    <link rel="stylesheet" href="./css/base.css">
    <link rel="stylesheet" href="./css/coupons.css">
</head>
<body>
    <!-- 头部 -->
        <header>
                <a class="return" href="javascript:;">
                    <!-- <span class="icon-left"></span> -->
                    <div></div>
                    <!-- <img src="./images/返回 (1).png" alt=""> -->
                </a>
                <span class="header-title">
                        优惠券
                </span>
                 <a class="download" href="javascript:;">
                     <img src="./images/header_app.png" alt="">
                 </a>
        </header>
    <!-- 列表 -->
    <div class="box">
        <ul class="coupons">
            <li><a href="javascript:;">
                <img src="./images/kendeji.jpg" alt="">
                <span>肯德基</span>
            </a></li>
            <!-- <li><a href="javascript:;">
                <img src="./images/kendeji.jpg" alt="">
                <span>肯德基</span>
            </a></li>
            <li><a href="javascript:;">
                <img src="./images/kendeji.jpg" alt="">
                <span>肯德基</span>
            </a></li>
            <li><a href="javascript:;">
                <img src="./images/kendeji.jpg" alt="">
                <span>肯德基</span>
            </a></li> -->
        </ul>
    </div>
    <!-- 导引栏 -->
    <div class="guidance">
        <a href="./buy_slowly-coupons.html">首页</a>
        <a href="./buy_slowly-couponslist.html">></a>
        <a href="./buy_slowly-couponslist.html">优惠券</a>
    </div>
    <!-- 底部样式 -->
    <footer>
        <div class="footer-title">
              <a href="javascript:;">
                      登录
                  </a>
                  <a href="javascript:;">
                      注册
                  </a>
                  <a  id="goTop" href="javascript:;">
                      <!-- <img src="./images/返回顶部.png" alt=""> -->
                      <span>返回顶部</span>
                  </a>
        </div>
        <div class="footer-tools">
            <a href="javascript:;">手机APP下载</a>
            慢慢买手机版
            <span>--掌上比价平台</span>
            <h5>m.manmanbuy.com</h5>
        </div>
      </footer>
</body>
</html>
<script src="./js/jquery.min.js"></script>
<script src="./lib/template.js"></script>
<script id="couponstmp" type="text/template">
    {{each result as val key}}
    <li>
        <a href="./buy_slowly-couponslist.html?couponid={{val.couponId}}">
                <img src="{{val.couponImg}}" alt="">
            <span>{{val.couponTitle}}</span>
        </a>
    </li>
    {{/each}}
</script>
<script>

    $.ajax({
        type:"get",
        url:"http://193.112.55.79:9090/api/getcoupon",
        dataType:"jsonp",
        success:function(res){
        console.log(res);
        template.config("escape", false)
        var str = template("couponstmp",res);
        $(".coupons").html(str);
        }
    })
    $(function(){
    $("#goTop").click(function(){
        $('html,body').stop().animate({scrollTop: 0});
    });
});
</script>